<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@include file="/common/common.jspf"%>
<script type="text/javascript"
	src="${ctx}/js/item_resource/bom/bom_edit.js">
</script>
<style type="text/css">
.col-sm-3 {
	width: 15%;
	float: left;
}

.col-sm-9 {
	width: 85%;
	float: left;
}

label[class^="btn btn-default"] {
	margin-top: -4px;
}
</style>
</head>
<body>
	<div class="l_err" style="width: 100%; margin-top: 2px;"></div>
	<form id="form" name="form" class="form-horizontal" method="post"
		action="${ctx}/pi/pi_editEntity.shtml">
		<input type="hidden" class="form-control checkacc" value="${bom.id}"
			name="projectJcForMmap.id" id="id">
		<section class="panel panel-default">
			<div class="panel-body">
				<div class="form-group">
					<label class="col-sm-3 control-label">检验阶别</label>
					<div class="col-sm-9">
						<select  class="form-control" name="projectJcForMmap.ly_level" id="ly_level" >
							<c:choose>
								<c:when test="${bom.ly_level == 1}">
									<option value="1" selected = "selected">IQC</option>
                                    <%--<option value="2">FAl</option>--%>
                                    <%--<option value="3">OQC</option>--%>
								</c:when>
								<%--<c:when test="${bom.ly_level == 2}">--%>
                                    <%--<option value="1">IQC</option>--%>
									<%--<option value="2" selected = "selected">FAl</option>--%>
                                    <%--<option value="3">OQC</option>--%>
								<%--</c:when>--%>
								<%--<c:when test="${bom.ly_level == 3}">--%>
                                    <%--<option value="1">IQC</option>--%>
                                    <%--<option value="2" >FAl</option>--%>
									<%--<option value="3" selected = "selected">OQC</option>--%>
								<%--</c:when>--%>
                                <%--<c:otherwise>--%>
                                    <%--<option value="1">IQC</option>--%>
                                    <%--<option value="2">FAl</option>--%>
                                    <%--<option value="3">OQC</option>--%>
                                <%--</c:otherwise>--%>
							</c:choose>
						</select>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label">检验内容</label>
					<div class="col-sm-9">
						<input type="text" class="form-control checkabh" name="projectJcForMmap.ly_content" id="ly_content" value="${bom.ly_content}">
					</div>
				</div>
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-3 control-label">值域</label>
					<div class="col-sm-9">
						<select class="form-control" name="projectJcForMmap.ly_domain" id="ly_domain" >
							<c:choose>
								<c:when test="${bom.ly_domain == 1}">
									<option value="1" selected = "selected">范围值</option>
                                    <option value="2">状态值</option>
                                    <option value="3">固定值</option>
                                    <option value="4">标准值</option>
								</c:when>
								<c:when test="${bom.ly_domain == 2}">
                                    <option value="1">范围值</option>
									<option value="2" selected = "selected">状态值</option>
                                    <option value="3">固定值</option>
                                    <option value="4">标准值</option>
								</c:when>
								<c:when test="${bom.ly_domain == 3}">
                                    <option value="1">范围值</option>
                                    <option value="2">状态值</option>
									<option value="3" selected = "selected">固定值</option>
                                    <option value="4">标准值</option>
								</c:when>
								<c:when test="${bom.ly_domain == 4}">
                                    <option value="1">范围值</option>
                                    <option value="2">状态值</option>
                                    <option value="3">固定值</option>
									<option value="4" selected = "selected">标准值</option>
								</c:when>
							</c:choose>
						</select>
					</div>
				</div>
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-3 control-label">检验标准</label>
					<div class="col-sm-9">
						<input type="text" class="form-control checkName" readonly = "readonly"
							   name="projectJcForMmap.ly_standard"
							   id="ly_standard" value="${bom.ly_standard}">
					</div>
				</div>
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-3 control-label">上限</label>
					<div class="col-sm-9">
						<input type="text" class="form-control"
							   name="projectJcForMmap.ly_on" id="ly_on" value="${bom.ly_on}">
					</div>
				</div>
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-3 control-label">下限</label>
					<div class="col-sm-9">
						<input type="text" class="form-control"
							   name="projectJcForMmap.ly_down" id="ly_down" value="${bom.ly_down}">
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label">单位</label>
					<div class="col-sm-9">
						<input type="text" class="form-control"
							   name="projectJcForMmap.ly_unit" id="ly_unit" value="${bom.ly_unit}">
					</div>
				</div>
				<%--<input type="hidden" name="itemSize" value="${item_bom.size()}">--%>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>

			<!-- 开始处理清单 -->
			<%--<div class="line line-dashed line-lg pull-in"></div>--%>
			<%--<div class="panel panel-default">--%>
				<%--<div class="panel-heading">--%>
					<%--<h3 class="panel-title">物料清单子项</h3>--%>
				<%--</div>--%>
				<%--<div class="panel-body">--%>
					<%--<table class="table table-bordered">--%>
						<%--<thead>--%>
							<%--<tr>--%>
								<%--<th style="text-align: center; width:176px;">产品编码</th>--%>
								<%--<th style="text-align: center; width:135px;">产品名称</th>--%>
								<%--<th style="text-align: center;"><input type="button"--%>
									<%--class="btn btn-primary" onclick="insert_row(this)" value="增加"></th>--%>
							<%--</tr>--%>
						<%--</thead>--%>
						<%--<tbody id="tbl">--%>
							<%--<c:forEach items="${item_bom}" var="item_bom">--%>
								<%--<tr>--%>
									<%--<td>--%>
										<%--<div class="input-group" style="width: 100px;">--%>
											<%--<input type="text" class="form-control" style="width: 120px;" name="item_no_1" id="item_no_1"--%>
												<%--value="${item_bom.ly_child_code}"> <span--%>
												<%--class="input-group-btn">--%>
												<%--<button class="btn btn-info" id="workorder" type="button"--%>
													<%--style="height: 34px;"--%>
													<%--onclick="getItem('item_no_1','item_no');">--%>
													<%--<span class="glyphicon glyphicon-search"></span>--%>
												<%--</button>--%>
											<%--</span>--%>
										<%--</div>--%>
									<%--</td>--%>
									<%--<td>--%>
										<%--<div class="input-group">--%>
											<%--<input type="text" class="form-control"--%>
												<%--name="item_use_number_11" value="${item_bom.child_name}">--%>
										<%--</div>--%>
									<%--</td>--%>
									<%--<td><input type="button" class="btn btn-primary"--%>
										<%--onclick="insert_row(this)" value="增加"></td>--%>
									<%--<td><input type="button" class="btn btn-danger"--%>
										<%--onclick="deleteRow(this)" value="删除"></td>--%>
								<%--</tr>--%>
							<%--</c:forEach>--%>
						<%--</tbody>--%>
					<%--</table>--%>
				<%--</div>--%>
			<%--</div>--%>

		</div>
		<footer class="panel-footer text-right bg-light lter">
		<button type="submit" class="btn btn-success btn-s-xs">提交</button>
		</footer> </section>
	</form>

	<script type="text/javascript">
		$(document).ready(function(){
			var options = $("#ly_domain option:selected");
			if(options.val() == 1){
				$("#ly_standard").attr("readonly","readonly");
				$("#ly_on").removeAttr("readonly");
				$("#ly_down").removeAttr("readonly");
				$("#ly_unit").removeAttr("readonly");
			}else if(options.val() == 2){
				$("#ly_standard").attr("readonly","readonly");
				$("#ly_on").attr("readonly","readonly");
				$("#ly_down").attr("readonly","readonly");
				$("#ly_unit").attr("readonly","readonly");
			}else if(options.val() == 3){
				$("#ly_on").removeAttr("readonly");
				$("#ly_unit").removeAttr("readonly");
			}else if(options.val() == 4){
				$("#ly_standard").removeAttr("readonly","readonly");
				$("#ly_standard").attr("readonly");
				$("#ly_on").attr("readonly","readonly");
				$("#ly_unit").attr("readonly","readonly");
			}
		});

		$("#ly_domain").change(function(e){
			var options = $("#ly_domain option:selected");
			if(options.val() == 1){
				$("#ly_standard").attr("readonly","readonly");
				$("#ly_on").removeAttr("readonly");
				$("#ly_down").removeAttr("readonly");
				$("#ly_unit").removeAttr("readonly");
			}else if(options.val() == 2){
				$("#ly_standard").attr("readonly","readonly");
				$("#ly_on").attr("readonly","readonly");
				$("#ly_down").attr("readonly","readonly");
				$("#ly_unit").attr("readonly","readonly");
			}else if(options.val() == 3){
				$("#ly_on").removeAttr("readonly");
				$("#ly_unit").removeAttr("readonly");
			}else if(options.val() == 4){
				$("#ly_standard").removeAttr("readonly","readonly");
				$("#ly_standard").attr("readonly");
				$("#ly_on").attr("readonly","readonly");
				$("#ly_unit").attr("readonly","readonly");
			}
		});


		// var i = 0
		// function insert_row(obj) {
		// 	i++;
		// 	R = tbl.insertRow(tbl.rows.length);
		// 	C = R.insertCell(0);
		// 	C.innerHTML = '<div class="input-group" style="width: 100px;"><input type="text" style="width: 120px;" class="form-control" name="item_no_1"id="item_no_1_'+i+'">'
		// 			+ '<span class="input-group-btn">'
		// 			+ '<button class="btn btn-info" id="workorder" type="button"style="height: 34px;" '
		// 			+ 'onclick="getItem(\'item_no_1_'+i+'\',\'item_no\');">'
		// 			+ '<span class="glyphicon glyphicon-search"></span></button></span></div>';
		// 	C = R.insertCell(1);
		// 	C.innerHTML = '<div class="input-group"><input type="text" class="form-control" name="item_use_number_11" id="item_use_number_11"></div>';
		// 	C = R.insertCell(2);
		// 	C.innerHTML = '<div class="input-group"><input type="text" class="form-control" name="item_balance_up_1" id="item_balance_up_1"></div>';
		// 	C = R.insertCell(3);
		// 	C.innerHTML = '<div class="input-group"><input type="text" class="form-control" name="item_balance_down_1" id="item_balance_down_1"></div>';
		// 	C = R.insertCell(4);
		// 	C.innerHTML = '<input type="button" class="btn btn-primary" onclick ="insert_row(this)" value = "增加">';
		// 	C = R.insertCell(5);
		// 	C.innerHTML = '<input type="button" class="btn btn-danger" onclick ="deleteRow(this)" value ="删除">';
		// }
		// function deleteRow(obj) {
		// 	var i = obj.parentNode.parentNode.rowIndex;
		// 	if (i > 0) {
		// 		tbl.deleteRow(i-1);
		// 	}
		// }
	</script>
</body>
</html>